package com.woniu.stafforder.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.common.util.ResponseData;
import com.woniu.stafforder.dto.OrderServiceDto;
import com.woniu.stafforder.entity.OrderService;
import com.woniu.stafforder.service.OrderServiceService;
import com.woniu.stafforder.mapper.OrderServiceMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author Administrator
* @description 针对表【t_order_service(订单业务类型)】的数据库操作Service实现
* @createDate 2024-05-24 14:48:38
*/
@Service
public class OrderServiceServiceImpl extends ServiceImpl<OrderServiceMapper, OrderService>
    implements OrderServiceService{

    @Override
    public ResponseData<?> queryServiceByTypeId(Integer typeId) {
        List<OrderService> orderServiceList = lambdaQuery().eq(OrderService::getOrderTypeId, typeId).list();
        List<OrderServiceDto> orderServiceDtoList = orderServiceList.stream().map(orderService -> {
            OrderServiceDto orderServiceDto = new OrderServiceDto();
            orderServiceDto.setId(orderService.getId());
            orderServiceDto.setServiceName(orderService.getServiceName());
            return orderServiceDto;
        }).collect(Collectors.toList());
        return new ResponseData<>().ok(orderServiceDtoList);
    }
}




